//
//  FirstTableViewCell.m
//  UI_喜马拉雅
//
//  Created by Zhai on 15/12/21.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "FirstTableViewCell.h"
#import "FirstLittleCollectionViewCell.h"

@implementation FirstTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;

}

- (void)create{
   
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(100, 120);
  
    // 设置item 与屏幕四周的间距 上 左  下  右
    flowLayout.sectionInset = UIEdgeInsetsMake(40, 10, 10, 10);
    // 设置最小行间距
    flowLayout.minimumLineSpacing = 10;
    // 设置最小列间距
    flowLayout.minimumInteritemSpacing = 10;

    self.myCollectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 5, 375, 180) collectionViewLayout:flowLayout];
//    self.myCollectionView = [[UICollectionView alloc]initWithFrame:[[UIScreen mainScreen]bounds] collectionViewLayout:flowLayout];
    self.myCollectionView.backgroundColor = [UIColor yellowColor];
    self.myCollectionView.delegate = self;
    self.myCollectionView.dataSource = self;
    [self addSubview:self.myCollectionView];
    
    [self.myCollectionView registerClass:[FirstLittleCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    
        self.FirstTitle = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 200, 40)];
        self.FirstTitle.backgroundColor = [UIColor greenColor];
        [self addSubview:self.FirstTitle];
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 3;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    FirstLittleCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor redColor];

    return cell;
    
}
@end
